Skip to content

Conversation

@aaupov
Copy link
Contributor

@aaupov aaupov commented Feb 6, 2025

If BOLT fails to locate DWO CU when using split DWARF, this signifies an
issue with the input (missing .dwo) rather than an internal assertion.

Created using spr 1.3.4
@llvmbot
Copy link
Member

llvmbot commented Feb 6, 2025

@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/125976.diff

1 Files Affected:

  • (modified) bolt/lib/Core/BinaryContext.cpp (+4-1)
diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp
index f5e11358daaa32b..3947c62ac8df00e 100644
--- a/bolt/lib/Core/BinaryContext.cpp
+++ b/bolt/lib/Core/BinaryContext.cpp
@@ -1759,7 +1759,10 @@ void BinaryContext::preprocessDebugInfo() {
           dwarf::toString(CU->getUnitDIE().find(dwarf::DW_AT_name), nullptr);
       if (std::optional<uint64_t> DWOID = CU->getDWOId()) {
         auto Iter = DWOCUs.find(*DWOID);
-        assert(Iter != DWOCUs.end() && "DWO CU was not found.");
+        if (Iter == DWOCUs.end()) {
+          this->errs() << "DWO CU was not found for " << Name << '\n';
+          exit(1);
+        }
         Name = dwarf::toString(
             Iter->second->getUnitDIE().find(dwarf::DW_AT_name), nullptr);
       }

Copy link
Contributor

@maksfb maksfb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a brief summary why you are converting the assertion. Small nit for the error message. Otherwise LGTM.

Created using spr 1.3.4
@aaupov aaupov merged commit b884be8 into main Feb 6, 2025
4 of 6 checks passed
@aaupov aaupov deleted the users/aaupov/spr/bolt-exit-with-error-code-on-missing-dwo-cu branch February 6, 2025 18:01
Icohedron pushed a commit to Icohedron/llvm-project that referenced this pull request Feb 11, 2025
If BOLT fails to locate DWO CU when using split DWARF, this signifies an
issue with the input (missing .dwo) rather than an internal assertion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants